package br.com.jogodavelha.activitys;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import br.com.jogodavelha.R;

public class SelecionaDificuldadeActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.seleciona_dificuldade_layout);

		Button btnAvancar = (Button)findViewById(R.id.btnAvancarDificJog);

		final RadioButton rbEasy = (RadioButton)findViewById(R.id.rbEasy);
		final RadioButton rbMedium = (RadioButton)findViewById(R.id.rbMedium);
		final RadioButton rbHard = (RadioButton)findViewById(R.id.rbHard);

		btnAvancar.setOnClickListener(new OnClickListener() {			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(SelecionaDificuldadeActivity.this, SelecionaNomeJogadoresActivity.class);
				intent.putExtra("modo", "OnePlayer");
				if(rbEasy.isChecked() == true){
					intent.putExtra("dificuldade", "Easy");
				}else if(rbMedium.isChecked() == true){
					intent.putExtra("dificuldade", "Medium");
				}else if(rbHard.isChecked() == true){
					intent.putExtra("dificuldade", "Hard");
				}
				startActivity(intent);				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.seleciona_dificuldade, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
}
